package models;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
@DiscriminatorValue(value="3")
public class Owner extends User {
	@ManyToMany(cascade = CascadeType.REMOVE, fetch=FetchType.LAZY)
	@JoinTable(name = "Owner_Establishment", joinColumns = @JoinColumn(name = "owner_id"), inverseJoinColumns = @JoinColumn(name = "place_id"))
	private Set<Establishment> establishments;

	public Set<Establishment> getEstablishments() {
		return establishments;
	}

	public void setEstablishments(Set<Establishment> establishments) {
		this.establishments = establishments;
	}
	
	@Override
	public boolean isAdmin() {
		return false;
	}

}
